﻿package mortal.game.view.warehouse.panel
{
    import Message.Public.*;
    import com.mui.controls.*;
    import extend.language.*;
    import flash.events.*;
    import flash.text.*;
    import mortal.game.cache.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.button.*;
    import mortal.game.view.common.display.*;
    import mortal.mvc.core.*;

    public class WarehouseBottomPart extends GSprite
    {
        private var _CapacityTxt:BitmapNumberText;
        private var _btnHebin:GButton;
        private var _btnZhengli:TimeButton;

        public function WarehouseBottomPart()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this.pushUIToDisposeVec(UIFactory.bg(0, 0, 333, 54, this, ImagesConst.PanelBg));
            var _loc_1:* = new TextFormat();
            _loc_1.color = 16313037;
            this.pushUIToDisposeVec(UIFactory.gTextField(Language.getString(35604), 5, 16, 65, 20, this, _loc_1, true, false));
            _loc_1.color = 16777215;
            this._CapacityTxt = UIFactory.bitmapNumberText(67, 21, "RoleInfoNum.png", 8, 10, -1, this, 14);
            this._btnHebin = UIFactory.gButton(Language.getString(35605), 128, 14, 50, 22, null);
            this._btnZhengli = UIFactory.timeButton(Language.getString(35606), 266, 14, 50, 22, this);
            this._btnZhengli.cdTime = 10000;
            this.configEventListener(MouseEvent.CLICK, this.clickHandler);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._CapacityTxt.dispose(param1);
            this._CapacityTxt = null;
            this._btnHebin.dispose(param1);
            this._btnHebin = null;
            this._btnZhengli.dispose(param1);
            this._btnZhengli = null;
            super.disposeImpl(param1);
            return;
        }// end function

        private function clickHandler(event:MouseEvent) : void
        {
            switch(event.target)
            {
                case this._btnHebin:
                {
                    break;
                }
                case this._btnZhengli:
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.BackPack_Tity, EPlayerItemPosType._EPlayerItemPosTypeWarehouse));
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

        public function updateCapacity() : void
        {
            var _loc_1:* = Cache.instance.pack.warehouseCache.itemLength;
            var _loc_2:* = Cache.instance.pack.warehouseCache.capacity;
            this._CapacityTxt.text = _loc_1 + "/" + _loc_2;
            return;
        }// end function

    }
}
